package com.sherlockHolmes.init.controller;

import com.sherlockHolmes.init.base.result.Ajax;
import com.sherlockHolmes.init.entity.dto.AssetDTO;
import com.sherlockHolmes.init.service.UserInfoService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/asset")
public class AssetController {
    @Resource
    private UserInfoService assetService;
    //资产增加
    @PostMapping("/add")
    public Ajax add(@RequestBody AssetDTO asset){
        try{
           return Ajax.success(assetService.addAsset(asset));
        }catch (Exception e){
            return Ajax.fail(e);
        }
    }
    //资产减少
    @PostMapping("/reduce")
    public Ajax reduce(@RequestBody AssetDTO asset){
        try{
            return Ajax.success(assetService.reduceAsset(asset));
        }catch (Exception e){
            return Ajax.fail(e);
        }
    }
    //资产冻结
    public void freeze(){

    }
    //资产解冻
    public void unfreeze(){

    }
}
